/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */

package com.poltman.dscentral.communities;


import org.apache.log4j.Logger;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Tree;

import com.poltman.dscentral.core.dspace.Communities;

/**
 * 
 * @author z.ciok@poltman.com
 *
 */

@SuppressWarnings("rawtypes")
public class NewTopLevelCommunityTreeController extends GenericForwardComposer {
	
	private static final long serialVersionUID = -2197516046721712489L;

	private static Logger log = Logger.getLogger(NewTopLevelCommunityTreeController.class);
	
	private Tree tree;
	
	@SuppressWarnings("unchecked")
	@Override
    public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
    	super.doAfterCompose(comp);
    	
    	Communities communities = new Communities();
    	communities.setTree(this.tree); 
    	
        tree.setModel(new CommunityTreeModel());
        tree.setItemRenderer(new NewTopLevelCommunityTreeRenderer(communities));
    }
}
